<#include "include/_meta.html">
<title>我要还车</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 还车管理 <span class="c-gray en">&gt;</span> 还车列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="text-c">
		输入审核ID：<input type="text" class="input-text" style="width:250px" placeholder="输入审核ID" id="checkId" name="checkId">
		车牌号：<input type="text" class="input-text" style="width:250px" placeholder="输入车牌号" id="carIdCard" name="carIdCard">
		<button type="button" onclick="loadcheck(1)" class="btn btn-success" id="searchOrders" name=""><i class="Hui-iconfont">&#xe665;</i> 搜订单</button>
	</div>

	<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"> </span> <span class="r">共有数据：<strong id="pageTotal"></strong> 条</span> </div>
	<table id="orderListTable" class="table table-border table-bordered table-bg table-hover">
		<thead>
		<tr>
			<th scope="col" colspan="9">订单列表</th>
		</tr>
		<tr class="text-c">
			<th >审核订单ID</th>
			<th >汽车ID</th>
			<th >订单ID</th>
			<th >审核人ID</th>
			<th >车牌号</th>
			<th >车辆型号</th>
			<th >操作</th>
		</tr>
		</thead>
		<tbody>
		<tr class="text-c" v-for="(item,index) in result">
			<td >{{item.checkId}}</td>
			<td >{{item.carId}}</td>
			<td >{{item.orderID}}</td>
			<td >{{item.userId}}</td>
			<td >{{item.carIdCard}}</td>
			<td >{{item.carModel}}</td>
			<td >
				<a v-if="item.userId!=null" href="#" @click="SeecheckEvent(item.checkId)">查看/二次审核</a>
				<a v-if="item.userId==null" href="#" @click="checkEvent(item.checkId)">审核</a>
				<a v-if="item.userId!=null" href="#" @click="delEvent(item.checkId)">删除</a>
			</td>
		</tr>
		</tbody>
		<tr>
			<td colspan="3">
				<div id="pagenav"></div>
			</td>
		</tr>
	</table>
</div>

<#include "include/_footer.html">

<script type="text/javascript">
	var app =  new Vue({
		el:"#orderListTable",
		data:{
			result:[],
			hava:""
		}
	});

	function loadcheck(curr) {
		$.ajax({
			type:"POST",
			url:"/checklist",

			data:{
				PageNum:curr || 1,
				checkId:$("#checkId").val(),
				carIdCard:$("#carIdCard").val(),
				PageSize:10
			},
			dataType:"json",
			success:function (result) {
				app.result = result.page.records;
				$("#pageTotal").text(result.page.total);
				laypage({
					cont: "pagenav",
					first: "首页",
					pages: result.totalPage,
					skin: "#DB7023",
					last: "最后一页",
					curr: curr || 1,
					jump: function (obj, first) {
						if (!first) {
							loadcheck(obj.curr);
						}
					}
				});
			}
		})
	}
	loadcheck();

	var checkEvent = function(id){
		layer.open({
			type: 2,
			title: "审核车辆",
			fix: false,
			maxmin: true,
			shadeClose: true,
			area: ['500px', '600px'],
			content: "/checkquery?checkId=" + id,
			end: function () {
				loadcheck();
			}
		})
	}

	var SeecheckEvent = function(id){
		layer.open({
			type: 2,
			title: "查看/二次审核车辆",
			fix: false,
			maxmin: true,
			shadeClose: true,
			area: ['500px', '600px'],
			content: "/SeecheckEvent?checkId=" + id,
			end: function () {
				loadcheck();
			}
		})
	}

	var delEvent = function(id) {
		layer.confirm("是否确认删除",{
			btn:[ "是","否"]
		},function () {

			console.log("id==="+id);
			$.ajax({
				type: "POST",
				url: "/delcheck",
				data: {
					checkId:id
				},
				dataType: "json",
				success: function (result) {
					loadcheck();
					if(result.flag==1){
						layer.msg(result.flag+":"+result.msg, {icon: 6});
					}else{
						layer.msg(result.flag+":"+result.msg, {icon: 5});
					}
				}
			});
		},function () {

		})
	}
</script>
</body>
</html>